<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">


<ui:composition template="/templates/template.xhtml">
	
	<ui:define name="conteudoPagina">
			
	<p:ajaxStatus style="width:24px;height:24px;">
			<f:facet name="start">
				<h:graphicImage value="/resources/imagens/loader.gif" />
			</f:facet>
			<f:facet name="complete">
				<h:outputText value="" />
			</f:facet>
		</p:ajaxStatus>
 	
 	<h:form >
    <p:messages  id="msg" closable="true"/>
    <p:panel header="Cadastro de Zonas por Cidade">    
           <h:panelGrid columns="2" columnClasses="label, value">
              <p:outputLabel value="Cidade"/>
              <p:selectOneMenu id="cboCidade"
							value="#{zonaBean.zonaSelecionada.cidade}" >
							<f:selectItem itemLabel="Escolha uma cidade" />
							<f:selectItems value="#{zonaBean.cidadeSelect}" />
			 </p:selectOneMenu>
     		 <p:outputLabel value="Zona" />
			 <p:inputText value="#{zonaBean.zonaSelecionada.zona}" />										
           </h:panelGrid>
                          
 	</p:panel>
                <p:commandButton value="Salvar" actionListener="#{zonaBean.salvar}" update="msg,tbZonasCidade"/>	            

	<br/>
	<br/>
		
			<p:dataTable id="tbZonasCidade" value="#{zonaBean.listaZonas}" var="zonaS" border="1" style="width:50%">
			<f:facet name="header">Listagem de Cidades Cadastradas</f:facet>
			<p:column headerText="Id" width="1">
        		<h:outputText value="#{zonaS.id}" />
    		</p:column>
			<p:column headerText="Cidade" width="10">
        		<h:outputText value="#{zonaS.cidade.nome}" />
    		</p:column>
    		<p:column headerText="Numero Zona" width="5">
        		<h:outputText value="#{zonaS.zona}" />
    		</p:column>
	</p:dataTable>
			
	</h:form>
	</ui:define>
</ui:composition>
</html>